import {
    center,
    grid,
    header,
    button,
    search,
} from '@/css/VueCss.module.scss' ;

export default {
    title: '公共客户池',
    items: [{
        region: 'center',
        class: center,
        layout: 'vertical',
        items: [{
            items: [{
                id: 'search',
                class: search,
                widget: 'search-datesearch',
                times: [{
                    label: '今日',
                    value: 'today'
                }, {
                    label: '昨日',
                    value: 'yesterday'
                }, {
                    label: '近7日',
                    value: 'lately7'
                }, {
                    label: '近30日',
                    value: 'lately30'
                }],
                rangeTimes: true,
                text: {
                    field: 'keywords',
                    placeholder: '请输入客户(公司)'
                },
                onSearch: [{
                    action: 'grid-load',
                    target: '$widgets.grid',
                    params: {
                        page_size: '$widgets.grid.pageSize',
                        keywords: '$params.keywords',
                    }
                }]
            }, {
                class: header,
                layout: 'horizontal',
                items: [{
                    class: button,
                    type: 'primary',
                    plain: true,
                    widget: 'button',
                    value: '分配',
                    onClick: [{
                        var: 'checkedItemIds',
                        action: 'array-value',
                        target: '$widgets.grid.checkedItems',
                        key: 'id'
                    }, {
                        action: 'dialog-show',
                        path: 'CustomersPool/Public/Distribution',
                        params: {
                            title: "'客户分配'",
                            form: {
                                ids: '$vars.checkedItemIds'
                            }
                        },
                        applyActions: [{
                            action: 'call',
                            target: '$widgets.grid',
                            method: 'reload'
                        }],
                        cancelActions: [{
                            action: 'print',
                            description: '取消对话框'
                        }]
                    }]
                }]
            }]
        }, {
            id: 'grid',
            class: grid,
            widget: 'grid',
            service: {
                path: 'customers_pool/public/customer/list',
                params: {
                    state: '1',
                    salesman: ''
                }
            },
            pageSize: 20,
            columns: [{
                prop: 'status_uuid',
                label: '回访状态',
                dictionary: {
                    path: 'common/dictionary/config',
                    params: {
                        name: 'return_visit_status',
                    },
                },
                width: 120
            }, {
                prop: 'source_uuid',
                label: '客户来源',
                width: 120
            }, {
                prop: 'corporate_name',
                label: '客户名称(公司)',
                minWidth: 280
            }, {
                prop: 'operate_status',
                label: '登记状态',
                width: 80
            }, {
                prop: 'legal_representative',
                label: '法定代表人',
                width: 120
            }, {
                prop: 'registered_capital',
                label: '注册资本',
                width: 160
            }, {
                prop: 'establishment_date',
                label: '成立时间',
                width: 120
            }, {
                prop: 'telephone',
                label: '电话',
                width: 140
            }, {
                prop: 'email',
                label: '邮箱',
                width: 160
            }, {
                prop: 'website',
                label: '网站',
                width: 160
            }, {
                prop: 'province',
                label: '所属省份',
                minWidth: 80
            }, {
                prop: 'city',
                label: '所属城市',
                minWidth: 80
            }, {
                prop: 'county',
                label: '所属区县',
                minWidth: 80
            }, {
                prop: 'update_time',
                label: '转入时间',
                width: 180
            }],
            buttons: [{
                value: '分配',
                onClick: [{
                    action: 'dialog-show',
                    path: 'CustomersPool/Public/Distribution',
                    params: {
                        title: "'客户分配'",
                        form: {
                            ids: '$widgets.grid.selectedItem.id',
                        }
                    },
                    applyActions: [{
                        action: 'call',
                        target: '$widgets.grid',
                        method: 'reload'
                    }],
                    cancelActions: [{
                        action: 'print',
                        description: '取消对话框'
                    }]
                }]
            }, {
                value: '详情',
                onClick: [{
                    action: 'dialog-show',
                    path: 'CustomersPool/Temporary/Details',
                    params: '$params',
                }]
            }],
            flex: true,
            enableCheckboxColumn: true,
        }]
    }]
};
